﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ctrlItemMarca.ascx.cs" Inherits="EstoqueUnifeiADO.Controles.ctrlItemMarca" %>
<asp:UpdatePanel ID="upItem" runat="server">
    <ContentTemplate>
        <asp:HiddenField ID="hfKey" runat="server" />
        <asp:ObjectDataSource ID="odsItem" runat="server" DeleteMethod="Delete" InsertMethod="InsertWithLastKey"
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByID" TypeName="EstoqueUnifeiADO.Dados.dsMarcasTableAdapters.MARCATableAdapter"
            UpdateMethod="Update" onselecting="odsItem_Selecting" 
            oninserted="odsItem_Inserted">
            <DeleteParameters>
                <asp:Parameter Name="Original_CODMARCA" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="NOMEMARCA" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="hfKey" Name="CODMARCA" PropertyName="Value" 
                    Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="NOMEMARCA" Type="String" />
                <asp:Parameter Name="Original_CODMARCA" Type="Int32" />
            </UpdateParameters>
        </asp:ObjectDataSource>
        <asp:Panel ID="pnlMensagem" runat="server" Visible="false" BackColor="#FFFFCC" Width="98%" 
        BorderColor="#FFFFCC" BorderStyle="Solid" BorderWidth="1px" >
        <asp:Label ID="lbMensagem" runat="server" Text="LbMensagem" Font-Italic="True"></asp:Label>
        </asp:Panel>
        <asp:ValidationSummary ID="vsPage" runat="server" BackColor="White" 
                    BorderColor="Red" BorderWidth="2px" ForeColor="Red" Width="98%" />
        <asp:FormView ID="fvItem" runat="server" DataSourceID="odsItem" DataKeyNames="CODMARCA"
            OnDataBound="FormView1_DataBound" Width="100%" BorderColor="Black" 
            BorderWidth="1px" BorderStyle="Solid"
            onitemupdated="fvItem_ItemUpdated" oniteminserted="fvItem_ItemInserted">
            <EditItemTemplate>
                Código:<br />
                <asp:Label ID="CODMARCALabel1" runat="server" Text='<%# Eval("CODMARCA") %>' />
                <br />
                Nome da marca:<br />
                <asp:TextBox ID="NOMEMARCATextBox" runat="server" 
                    Text='<%# Bind("NOMEMARCA") %>' /><asp:RequiredFieldValidator ID="RequiredFieldValidator1"
                        runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="NOMEMARCATextBox"></asp:RequiredFieldValidator>
                <br />
               
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                    Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
                    CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                Nome da marca:<br />
                <asp:TextBox ID="NOMEMARCATextBox" runat="server" 
                    Text='<%# Bind("NOMEMARCA") %>' />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Campo obrigatório"
                ControlToValidate="NOMEMARCATextBox"></asp:RequiredFieldValidator>
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                    Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
                    CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                Código:<br />
                <asp:Label ID="CODMARCALabel" runat="server" Text='<%# Eval("CODMARCA") %>' />
                <br />
                Nome da marca:<br />
                <asp:TextBox ID="NOMEMARCALabel" runat="server" Text='<%# Bind("NOMEMARCA") %>' Enabled="false" Width="98%"/>
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                    Text="Edit" />
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
                    Text="New" />
            </ItemTemplate>
        </asp:FormView>
    </ContentTemplate>
</asp:UpdatePanel>